package cn.gogpay.dcb.api.entity;

import cn.gogpay.dcb.common.entity.BaseEntity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 充值记录
 *
 * @author jiaoming@gogpay.cn
 * @date 2019/12/2 23:00
 */
@EntityListeners(AuditingEntityListener.class)
@Entity
public class OrderRecord  {

    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @Column(length = 32)
    private String id;

    @Column(columnDefinition = "varchar(5) default '0' comment '状态,0:初始,1:支付成功,2:销帐成功，3:退款'")
    private String status;

    @Column(columnDefinition = "comment '创建时间'")
    @CreatedDate
    @JsonIgnore
    private LocalDateTime createTime;

    @Column(columnDefinition = "comment '修改时间'")
    @LastModifiedDate
    @JsonIgnore
    private LocalDateTime updateTime;

    @Column(columnDefinition = "varchar(225) COMMENT 'goodsItem表的主键id，当充值金额为自定义时，该字段为空'")
    private String goodsItemId;


    @Column(nullable = true, columnDefinition = "varchar(225) COMMENT '价格'")
    private BigDecimal price;

    /**
     * 支付类型
     */
    @Column(nullable = true, columnDefinition = "varchar(225) COMMENT '支付类型'")
    private String payType;
    /**
     * 支付状态
     */
    @Column(nullable = true, columnDefinition = "varchar(5) COMMENT '支付状态'")
    private String payStatus;

    /**
     * 订单号
     */
    @Column(nullable = true, columnDefinition = "varchar(225) COMMENT '订单号'")
    private String orderNo;

    /**
     * 用户ID
     */
    @Column( columnDefinition = "varchar(32) COMMENT '用户ID'")
    private String userId;
    /**
     * 电话号码
     */
    @Column( columnDefinition = "varchar(15) COMMENT '电话号码'")
    private String phone;
    /**
     * 公交卡号
     */
    @Column( columnDefinition = "varchar(32) COMMENT '公交卡号'")
    private String cardNo;

    @Column( columnDefinition = "varchar(32) COMMENT '充值后余额'")
    private String balance;

    public String getGoodsItemId() {
        return goodsItemId;
    }

    public void setGoodsItemId(String goodsItemId) {
        this.goodsItemId = goodsItemId;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(String payStatus) {
        this.payStatus = payStatus;
    }

    public String getBalance() {
        return balance;
    }

    public void setBalance(String balance) {
        this.balance = balance;
    }
}
